/******************************************************************************
 *
 * ngcap - network sniffer using raw sockets
 *
 * Author:        cr
 * E-mail:        cr.at.netgarage.org
 * WWW:           http://www.netgarage.org
 * Copyright (C): 2009 by cr
 *
 * This file is part of ngcap.
 *
 * ngcap is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * ngcap is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with ngcap.  If not, see <http://www.gnu.org/licenses/>.
 *
 *****************************************************************************/

//#include "packet_header.hpp"
#include <iostream>
//#include <string>
#include <sstream>
//#include <iomanip>
//#include "trace.hpp"
#include <vector>
#include "frame.hpp"
#include "packet.hpp"


capturedPacket::capturedPacket() : drop(true) { 
    ++packetcount; 
}


void capturedPacket::print() {
    std::cout<<"Packet Number: "<<packetcount<<"\n";
    end=packet.end();
    for(it=packet.begin(); it!=end; ++it)
        std::cout<<(*it)->toString()<<std::endl;
    std::cout<<"\n\n";
}


void capturedPacket::clear() {
    end=packet.end();
        for(it=packet.begin(); it!=end; ++it)
            delete *it;
}

bool capturedPacket::getDrop() const { 
    return drop; 
}
 
void capturedPacket::setDrop(bool d) { 
    drop=d; 
}

Packet::Packet(unsigned char* p, unsigned int s) : data(p), size(s) { 
}

unsigned char* Packet::getData() const { 
    return data; 
}


unsigned int Packet::getSize() const { 
    return size; 
}

